<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Administrator
 * Date: 12-8-30
 * Time: 下午9:27
 * To change this template use File | Settings | File Templates.
 */
include_once("class/Sqlite.class.php");
$db = new db_sqlite;//实例db_sqlite类
$db -> connect('elela.db');//打开数据库
//var_dump($db);

//添加用户：
$sql1=sprintf('INSERT INTO "main"."el_users" ("email", "nickname", "remark") VALUES ("%s", "%s", "%s")','fe@cisco.com','afei','testRemark!');
//$db->query($sql1);

//查询用户：
$sql2=sprintf('SELECT * FROM "el_users"');
$query2=$db->query($sql2);
while($res=$db->fetch_array($query2)){
    echo $res['email'] . "<br />";
}

//INSERT INTO "main"."el_orders" ("uid", "food", "price", "pay_has", "date") VALUES (2, '红烧牛腩饭', 15, 0, '2012-08-30')
//当天吃饭消费情况添加
$sql3=sprintf('INSERT INTO "main"."el_orders" ("uid", "food", "price", "pay_has", "date") VALUES ("%s", "%s", "%s", "%s", "%s")','1','红烧牛腩饭', 15, 0, '2012-08-30');
//$query3=$db->query($sql3);


//当天吃饭消费情况查询
$sql4=sprintf('SELECT * FROM "el_orders"');
$query4=$db->query($sql4);
while($res=$db->fetch_array($query4)){
    echo $res['price'] . "<br />";
}



